feat: add ordinal gauge dimension column#26
Conversation
Multi-node resources (e.g. dedicated database StatefulSets) report one gauge sample per pod. Without a distinguishing dimension, replica rows for the same (metric, resourceId) collapse into one argMax series and corrupt each other. The ordinal column carries the pod ordinal (0 is the primary) so per-replica series stay distinct and remain queryable via filters and groupBy. Existing gauge tables gain the column automatically through ensureDimColumns (ADD COLUMN IF NOT EXISTS) at setup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Greptile SummaryThis PR introduces
Confidence Score: 3/5Safe to merge for ClickHouse deployments; existing Database adapter collections will not receive the new column on upgrade. The ClickHouse path is well-covered:
Important Files Changed
|
What
Adds
ordinalas a gauge-only dimension column:GAUGE_COLUMNS, gauge schema, gauge indexes (set(0)skipping index),LowCardinality(Nullable(String))column type, typedMetric::getOrdinal()accessor, and the appended column in the single-collectionDatabaseadapter.Why
Multi-node resources (e.g. dedicated database StatefulSets) report one gauge sample per pod. Without a distinguishing dimension, replica rows for the same
(metric, resourceId)collapse into oneargMaxseries and corrupt each other.ordinalcarries the pod ordinal (0= primary,1+= replicas) so per-replica series stay distinct and are queryable viaequal('ordinal', [...])filters andgroupBy('ordinal').Consumed by appwrite-labs/cloud for flat dedicated-database gauge metrics (DAT-1880), replacing
.replicaNmetric-name suffixes.Migration
Existing ClickHouse gauge tables gain the column automatically via
ensureDimColumns(ADD COLUMN IF NOT EXISTS) atsetup(). The skipping index applies to newly created tables only.Tests
testOrdinalIsGaugeOnly— column set/schema/index/extract/getter coverage, event schema unaffectedtestGaugeOrdinalSeparatesReplicaSeries— live ClickHouse round-trip: per-ordinal filter + groupBytestGaugeColumnsRoundTrip/testLowCardinalityOrdinalColumnextendedFull suite: 261 tests, 1281 assertions green in the compose stack. Lint + PHPStan clean.
🤖 Generated with Claude Code